<template>
    <div class="container">
        <div class="row">
            <div class="user_info">
                <div class="ui_left">
                    <div style="display: flex;">
                        <div class="icon-section">
                            <img class="ui_img" src="@/assets/images/touxiang.png" alt="">
                        </div>

                        <div class="user-base-info">
                            <span class="fz20_fw700">{{ this.$store.state.user.username}}</span>
                            <span class="fz14_color">ID:{{ this.id }}</span>
                            <span class="fz14_color">IP:{{ this.addr }}</span>
                        </div>
                    </div>
                    <div class="relation-section">
                        <div class="pointer fz18_color">
                            <div>关注:</div>
                            <div class="number fz18">{{ 0 }}</div>
                        </div>
                        <div class="pointer fz18_color">
                            <div>粉丝:</div>
                            <div class="number fz18">{{ 0 }}</div>
                        </div>
                        <div class="pointer fz18_color ">
                            <div>获赞:</div>
                            <div class="number fz18">{{ 0 }}</div>
                        </div>
                    </div>
                    <div class="signature fz18_color">
                        <div v-if="true">山里灵活的狗</div>
                    </div>
                    <div class="edit">
                        <button class="btn fz14">
                            编辑资料
                        </button>
                    </div>
                </div>
                <div class="ui_right">
                </div>
            </div>
            <div class="content-section">
                <div class="sub-section" @click="ic_active()">
                    <div class="Individual_center">
                        <div class="title_left fz20_fw700">个人中心</div>
                        <ul class="tap fz18_color ">
                            <li @click="push('/PagePost')">我的帖子</li>
                            <li @click="push('/MyComment')">我的评论</li>
                            <li @click="push('/MyCollection')">我的收藏</li>
                            <li @click="push('/MyAttention')">我的关注</li>
                            <li @click="push('/MyFans')">我的粉丝</li>
                        </ul>
                    </div>
                    <div class="Individual_center">
                        <div class="title_left fz20_fw700">设置管理</div>
                        <ul class="tap fz18_color ">
                            <li @click="push('/EditData')">编辑资料</li>
                            <li @click="push('/PrivacySettings')">隐私设置</li>
                            <li @click="push('/MyFeedback')">意见反馈</li>
                            <li @click="login_out()">退出登录</li>
                        </ul>
                    </div>
                </div>
                <div class="right_box">

                    <div class="main-section">
                        <router-view>

                        </router-view>
                    </div>
                </div>
            </div>
            <div>

            </div>
        </div>
    </div>

</template>

<script>
import '../assets/css/index.less'
import Cookie from "js-cookie";
export default {
    data() {
        return {
            title:null,
            addr: "重庆",
            id: 1002313144,
            data: [],
            activeIndex: null,
            clickedHTML :null,
        }
    },
    methods: {
        ic_active() {
            // 这里通过 event 参数获取点击的具体元素
            // 如果你使用事件代理，也可以通过 event.target 获取点击的具体元素
            // 这里假设你使用 event.target 获取当前点击的元素
            let target = event.target;
            let lis = document.querySelectorAll('.tap li');
            
            // 遍历所有 li 元素
            for (let i = 0; i < lis.length; i++) {
                // 如果当前点击的元素是 li 中的一个
                if (lis[i] === target) {
                    // 设置 activeIndex 为当前索引
                    this.activeIndex = i;
                    // 添加 active 类
                    lis[i].classList.add('active');
                } else {
                    // 其他 li 移除 active 类
                    lis[i].classList.remove('active');
                }
            }
        },
        push(route) {
                this.$router.push(route)
                this.title = event.target.innerHTML
        },
        login_out() {
            Cookie.remove('token')
        }
    }
}
</script>

<style lang="less" scoped>
.container {
            height: calc(100vh - 70px);
                display: flex;
                justify-content: center;
    .row {
                    // display: flex;
                    // flex-direction: column;
                    // border-radius: 8px;
                    // justify-content: flex-start;
        .user_info {
            display: flex;
            justify-content: space-between;
            width: 920px;
            padding: 40px;
            background-color: #ffffff;
            border-radius: 8px;
            margin-bottom: 10px;

            .ui_left {
                display: flex;
                flex-direction: column;
                width: 460px;
                height: 100%;
                .icon-section {
                    margin-right: 40px;

                    .ui_img {
                        width: 80px;
                        height: 80px;
                        border-radius: 100%;
                    }
                }

                .user-base-info {
                    display: flex;
                    flex-direction: column;

                    span {
                        margin-bottom: 10px;
                        display: flex;
                    }
                }

                .relation-section {
                    margin-top: 10px;
                    display: flex;

                    .pointer {
                        display: flex;
                        width: 80px;
                        margin-right: 40px;

                        .number {
                            margin-left: 20px;
                        }
                    }
                }

                .signature {
                    margin-top: 10px;
                }

                .edit {
                    margin: 20px 0 0 0;
                }

            }

            .ui_right {
                width: 460px;
                border-radius: 8px;
                background-color: #ececec;
            }


        }

        .content-section {
            display: flex;

            // background-color: #000000;
            .sub-section {
                width: 240px;
                height: 600px;
                // background-color: #ffffff;
                margin-right: 10px;

                overflow: hidden;

                .Individual_center {
                    display: flex;
                    justify-content: center;
                    flex-direction: column;
                    border-radius: 8px;
                    padding-bottom: 20px;
                    background-color: #fff;
                    margin-bottom: 10px;
                    .tap{
                        padding: 0;
                    }
                    .title_left {
                        width: 160px;
                        margin: 0 0 0 40px;
                        padding: 10px 0 10px 0;
                    }

                    ul {
                        margin-top: 10px;
                        
                        li {
                            position: relative;
                            height: 40px;
                            line-height: 40px;
                            list-style: none;
                            padding-left: 40px;
                            background-color: #ffffff;
                        }

                        .active {
                            background-color: #e1e1e1;
                        }

                        .active::after {
                            content: "";
                            position: absolute;
                            width: 4px;
                            height: 40px;
                            top: 0px;
                            left: 0;
                            background-color: #bfbfbf;
                        }
                    }
                }
            }

            .right_box {
                background-color: #eaeaea;
                border-radius: 8px;
                padding: 10px;
                box-sizing: border-box;
                .main-section {
                    overflow: scroll;
                    border-radius: 8px;
                    /* 只显示垂直滚动条 */
                    position: relative;
                    width: 750px;
                    height: 600px;
                }
                /* 宽度 */
                ::-webkit-scrollbar {
                    width: 0;
                    height: 0;
                }
                /* 背景色 */
                ::-webkit-scrollbar-track {
                    background-color: #f1f1f1;
                }
                /* 滑块 */
                ::-webkit-scrollbar-thumb {
                    background-color: #888;
                    border-radius: 5px;
                }
                /* 滑块悬停时 */
                ::-webkit-scrollbar-thumb:hover {
                    background-color: #555;
                }
            }
        }
    }
    



    // .down.div_select {
    //     display: block;
    // }
}
</style>